Skip to content

Add lightweight system tracing option#2723

Open
nicomazz wants to merge 1 commit into
airbnb:masterfrom
nicomazz:lottie_tracing_upstream
Open

Add lightweight system tracing option#2723
nicomazz wants to merge 1 commit into
airbnb:masterfrom
nicomazz:lottie_tracing_upstream

Conversation

@nicomazz

@nicomazz nicomazz commented Jun 11, 2026

Copy link
Copy Markdown

This PR introduces a new lightweight tracing option (enableLightTracing) for Lottie, allowing developers to monitor all Lottie animators receiving per-frame callbacks in Perfetto traces with minimal performance overhead.

Context: In Android SystemUI, we recently encountered several Lottie-related performance issues where animations were unintentionally running indefinitely due to caller bugs. While Lottie already supports tracing, enabling the full suite of Lottie trace markers proved to be too heavy for continuous monitoring on lab and field devices.

By introducing this lightweight tracing alternative, we were successfully able to spot and fix multiple animation leaks in production without the severe overhead of the full tracing suite.

(Upstreamed from AOSP)

@nicomazz nicomazz changed the title Lottie: Add dynamic trace names for doFrame and playAnimation Add lightweight system tracing option Jun 11, 2026
Enrich Lottie trace slices with composition source names (resource
entry name or asset filename) for easier identification in Perfetto
traces.

Changes:
- Thread sourceName from LottieCompositionFactory into
  LottieComposition for both raw resource and asset loading paths.
- Cache and use dynamic trace names in LottieValueAnimator.doFrame()
  and playAnimation() using Lottie's L trace API.
- Add setEnableLightTracing() builder API in LottieConfig to enable
  lightweight per-frame trace slices independently from the heavy
  setEnableSystraceMarkers option. This light tracing is safe to be
  always enabled in production with near zero performance overhead.

Bug: 520507665
Bug: 431188311
Test: Build success
Flag: EXEMPT DEBUG
Change-Id: I0c98012a1c531aa15b1057b1b1abf50a1a6c64ef
@nicomazz nicomazz force-pushed the lottie_tracing_upstream branch from 0c63a1b to 038b75e Compare June 11, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant